<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/public.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>库存列表</title>
	<script type="text/javascript" src="${ctx}/js/page.js"></script>
	<script type="text/javascript" src="${ctx}/js/search.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			getPartList();
			exportTable();
			//搜索
			$("#find").click(function(){
				var condition=$("#condition").val();
				var url2="${ctx}/store/getFList?condition="+condition;
				if(condition==""){
					getPartList();
				}else{
					search.cseatch(url2);
				}
			});
		});
	</script>

	<script type="text/javascript">
		function getPartList(){
			var url="${ctx}/store/getLimitList";
			var count=$("#count").val();
			page.pagePart(url,count);
		}
		function   customPage(obj){
			var total;
			$("#table tr:gt(1)").remove();
			for(var i=0;i<obj.length;i++){
				if(obj[i].storegeTotal==0){
                 total="";
				}else{
					total=obj[i].storegeTotal;
				}
				var storageType;
				if(obj[i].storageType==1){
					storageType="采购入库";
				}else{
					storageType="退货入库";
				}
				var newRow = "<tr>" +
						"<td>"+obj[i].id+"</td><td>"+obj[i].foodBarCode+"</td>" +
						"<td>"+obj[i].foodName+"</td><td>"+obj[i].foodStandard+"</td>" +
						"<td>"+obj[i].className+"</td><td>"+storageType+"</td>" +
						"<td>"+obj[i].storageDate+"</td><td>"+obj[i].overDate+"</td>" +
						"<td>"+obj[i].inputNum+"</td>" +
						"<td>"+obj[i].foodNum+"</td><td>"+total+"</td>" +
						"<td>"+obj[i].storegeMin+"</td>"/*<td>"+obj[i].providerName+"</td>"*/ +
						"<td>"+obj[i].remarks+"</td>" +


						"<td>"+"<a id='edit"+i+"' href='${ctx}/store/editStore?id="+obj[i].storeId+"'>修改&nbsp;&nbsp;</a>"+
						"<a id='delete"+i+"' href='${ctx}/store/delete?id="+obj[i].storeId+"&foodName="+obj[i].foodName+"'>删除&nbsp;&nbsp;</a>"+
						"<a id='out"+i+"' href='${ctx}/outStore/findStore?id="+obj[i].storeId+"'>出库&nbsp;&nbsp;</a>"+
						"</td></tr>";
				$("#table tr:last").after(newRow);
				var type=$("#type").val();
					if(type==1){
						$("#out"+i).hide();
						if(window.userPower!=0||window.userPower!=31||window.userPower!=12){
							$("#edit"+i).show();
							$("#delete"+i).show();
						}
					}else if(type==2){
						$("#edit"+i).hide();
						$("#delete"+i).hide();
						if(window.userPower!=0||window.userPower!=31||window.userPower!=12){
							$("#out"+i).show();
						}
		           	}else if(type==3){
						$("#out"+i).hide();
						$("#edit"+i).hide();
						$("#delete"+i).hide();

					}




			}

		}
	</script>


</head>

<body>
<input type="hidden" id="count" value="${count}">
<div class="pagin">
	<br/>
<%--	<a href="${ctx }/store/add">入库</a>
	<a href="${ctx }/outStore/list">出库列表</a>--%>
	<input type="hidden" value="${type}" id="type">
	<br/>   <br/>
	<input type="text" id="condition" placeholder="请输入ID或者名称等"><button id="find">搜索</button>
	<button id="export">导出</button>
	<br/><br/>
	<table id="table" class="t1" style="width: 90%">
		<tr >
			<c:if test="${type==1}"><th colspan="15">库存列表</th></c:if>
			<c:if test="${type==2}"><th colspan="15">出库列表</th></c:if>
			<c:if test="${type==3}"><th colspan="15">报警列表</th></c:if>
		</tr>
		<tr>
			<td>库存ID</td>
			<td>食品条码</td>
			<td>食品名称</td>
			<td>食品规格</td>
			<td>食品分类</td>
			<td>入库类型</td>
			<td>入库时间</td>
			<td>过期时间</td>
			<td>入库数量</td>
			<td>在库数量</td>
			<td>库存总量</td>
			<td>最低库存量</td>
		<%--	<td>供应商名称</td>--%>
			<td>备注</td>
			<td>操作</td>
		</tr>
	</table>
	<br/>
	<div id="Pagination" class="pagination"
		 style=" width: -moz-fit-content;width:-webkit-fit-content;width: fit-content;margin-left: auto;margin-right: auto;" ></div>
</div>

</body>
</html>